<template>
  <div>
    <h1 id="title">医疗服务申请</h1>
      <el-form-item label="姓名" class="input1" >
        <el-input v-model="name"></el-input>
      </el-form-item>
    <el-form-item label="地址" class="input2">
      <el-input v-model="place"></el-input>
    </el-form-item>
      <el-form-item label="申请医疗类型" class="input3">
        <el-select  v-model="type">
          <el-option label="量血压" value="1"></el-option>
          <el-option label="测核酸" value="2"></el-option>
          <el-option label="外伤处理" value="3"></el-option>、
          <el-option label="心理咨询" value="4"></el-option>
        </el-select>
      </el-form-item>
    <el-form-item label="交易时间"  prop="tradeTime">
        <el-date-picker
            value-format="YYYY-MM-DD HH:mm:ss"
            v-model="time"
            type="datetime"
            placeholder="Select date and time"
            :disabled-date="disabledDate"
        />
    </el-form-item>
    <el-form-item label="症状描述" class="input4">
      <el-input type="textarea" v-model="content"></el-input>
    </el-form-item>
    <el-button type="primary" class="input3" @click="medic()">提交</el-button>
  </div>

</template>


<script>
import request from "@/utils/request";


export default {
  name: "ShoppingCar",
  data(){
    return{
      disabledDate(time) {
        return time.getTime() < Date.now() - 8.64e7;//禁止选择今天以前的时间
      },
      orderInfo1:false,
      tableData:[
      ],
      readorder:false,
      goods: {},
      user: {},
      name:'',
      place:'',
      time:'',
      content:'',
      type:'',
    }
  },
  methods:{
    medic(){
      request.post("http://localhost:8082/user/medic?name="+this.name+"&place="+this.place+"&type="+this.type+"&time="+this.time+"&content="+this.content).then(res =>{
        if (res.flag) {
          this.$message({
            type: 'success',
            message: res.msg
          })
        }
        else {
          this.$message.error(res.msg);
        }
      })
    },
    getCollection() {
      request.get("http://localhost:8082/Collection/ShowUserCollection").then(res => {
        if (res.flag) {
          this.tableData = res.data['collections']
          this.user = res.data['user']
          this.$message({
            type: 'success',
            message: res.msg
          });
        } else {
          this.$message.error(res.msg);
        }
      })
    },
    Delete(row){
      request.delete("http://localhost:8082/Collection/RemoveFromCollection?id="+row.goods.id).then(res => {
        if (res.flag) {
          this.$message({
            type: 'success',
            message: res.msg
          });
        } else {
          this.$message.error(res.msg);
        }
      })
    },
  },
}


</script>

<style scoped>
#title {
  position: absolute;
  font-size:25px;
  left: 15%;
  top:10%;
  color:red;
}
.input1{
  margin-top:50px;
  margin-left:10px;
  width: 350px;
}
.input2{
  margin-top:20px;
  margin-left:10px;
  width: 350px;
}
.input3{
   margin-top:20px;
   margin-left:10px;
}
.input4{
  margin-top:20px;
  margin-left:10px;
  width: 370px;
}
</style>
